Tooltips and crosshairs
A tooltip is a popup that shows the points under the pointer. The chart decides which points to show with its
FindingStrategy, places the popup with TooltipPosition, and builds its text with the tooltip formatters of each
series. A crosshair is a line that follows the pointer across the plot area, with a label on the axis; it is set on
the axes. Legends have their own
article.

This article highlights the most used features. Every member is listed in the API explorer: TooltipPosition, FindingStrategy, SKDefaultTooltip, IChartTooltip and Axis.
Behaviour
With a mouse, the tooltip opens when the pointer moves over a point and closes when the pointer leaves the chart. On Android and iOS, slide your finger over the chart to open it; it closes when the finger goes up. The tooltip also closes when the user starts panning the chart.
Every series takes part in the tooltip. Set IsHoverable to false on a series to leave it out, it is true by
default.
Tooltip position
TooltipPosition places the tooltip. The default is Auto: the tooltip goes above the hovered points, or below
them when all of them are under the pivot of their series, such as negative columns. Top, Bottom, Left,
Right and Center place it at that side of the hovered points, or at their center. When the tooltip does not fit
in the chart at the requested side, it moves to another one. Hidden disables tooltips.
<CartesianChart
Series="series"
TooltipPosition="LiveChartsCore.Measure.TooltipPosition.Bottom"><!-- mark -->
</CartesianChart>
A pie chart always places the tooltip on the hovered slice, it only takes Hidden from this property.
Finding strategy
Every point drawn by the library has a
HoverArea, the zone of the chart that
selects that point. FindingStrategy sets how the chart compares the pointer position with those areas, to pick
the points shown in the tooltip and the points passed to the pointer events, such as DataPointerDown.
CompareAll: selects the points whose hover area contains the pointer.

CompareOnlyX: selects the points whose hover area contains the pointer on the X axis, the Y position is ignored.

CompareOnlyY: selects the points whose hover area contains the pointer on the Y axis, the X position is ignored.

ExactMatch: selects the points whose drawn shape contains the pointer.

CompareAllTakeClosest, CompareOnlyXTakeClosest, CompareOnlyYTakeClosest and ExactMatchTakeClosest compare the same way, but when several points of a series match, they keep only the closest to the pointer, one point per series.
Automatic is the default. Each series prefers a strategy: line, step line, column, financial and box series
prefer CompareOnlyXTakeClosest, row series prefer CompareOnlyYTakeClosest, and the others, such as scatter and
heat series, prefer none. When all the visible series prefer the same strategy the chart uses it, otherwise it uses
CompareAllTakeClosest.
<CartesianChart
Series="series"
FindingStrategy="LiveChartsCore.Measure.FindingStrategy.CompareOnlyX"><!-- mark -->
</CartesianChart>
The width of the hover area of a column or a point follows the UnitWidth of the axis. On a date time axis, set
the unit that matches your data, see
the unit.
Custom point finding
When no strategy fits, override how a series finds its points. By default, a column series selects all the columns that share the X coordinate of the pointer:

To show only the column under the pointer instead:

inherit from the series and override FindPointsInPosition(). The library calls it to resolve the points of the
tooltip (FindPointFor.HoverEvent) and of the pointer events (FindPointFor.PointerDownEvent):
using System.Collections.Generic;
using System.Linq;
using LiveChartsCore;
using LiveChartsCore.Drawing;
using LiveChartsCore.Kernel;
using LiveChartsCore.Kernel.Drawing;
using LiveChartsCore.Measure;
using LiveChartsCore.SkiaSharpView;
namespace ViewModelsSamples.Events.OverrideFind;
public class ViewModel
{
public ISeries[] Series { get; set; } = [
new CustomColumnSeries<int> { Values = [9, 5, 7, 3, 7, 3] },
new CustomColumnSeries<int> { Values = [8, 2, 3, 2, 5, 2] }
];
public class CustomColumnSeries<T> : ColumnSeries<T>
{
protected override IEnumerable<ChartPoint> FindPointsInPosition(
Chart chart, LvcPoint pointerPosition, FindingStrategy strategy, FindPointFor findPointFor)
{
return Fetch(chart).Where(point =>
{
var ha = (RectangleHoverArea?)point.Context.HoverArea;
if (ha is null) return false;
var isInsideX = ha.X <= pointerPosition.X && pointerPosition.X <= ha.X + ha.Width;
var isInsideY = ha.Y <= pointerPosition.Y && pointerPosition.Y <= ha.Y + ha.Height;
return findPointFor == FindPointFor.HoverEvent
? isInsideX
: isInsideY;
});
}
}
}
Another option is to replace the HoverArea of each point, the area that makes a point selectable and suggests
where the tooltip goes. See
this example.
Tooltip text
The default tooltip shows a header, then one row per point with the series miniature, the series
Name and the value. A series with no name shows no name in the
tooltip. Two properties of the series build that text, both take the point and return a string:
YToolTipLabelFormatterbuilds the value of each row.XToolTipLabelFormatterbuilds the header, from the first point in the tooltip.
When they are not set, a line or column series formats the value with the Labels or the Labeler of its Y axis.
The header uses the Labels or the Labeler of its X axis, and is left out while the X axis has neither. Some
series set their own YToolTipLabelFormatter: a scatter series shows X = and Y = (and W = when it is
weighted), a financial series shows the high, open, close and low values, a box series its five values, and a heat
series the Y label and the weight. Range series show both ends of the range.
Take these two series:
public ISeries[] Series { get; set; } = [
new LineSeries<double>
{
Values = [2, 1, 3, 5, 3, 4, 6],
Fill = null,
GeometrySize = 20
},
new LineSeries<int, StarGeometry>
{
Values = [4, 2, 5, 2, 4, 5, 3],
Fill = null,
GeometrySize = 20
}
];
By default the tooltip is:

YToolTipLabelFormatter changes the value:
public ISeries[] Series { get; set; } = [
new LineSeries<double>
{
Values = [2, 1, 3, 5, 3, 4, 6],
Fill = null,
GeometrySize = 20,
YToolTipLabelFormatter = point => point.Model.ToString("C2") // mark
},
new LineSeries<int, StarGeometry>
{
Values = [4, 2, 5, 2, 4, 5, 3],
Fill = null,
GeometrySize = 20,
YToolTipLabelFormatter = point => point.Model.ToString("C2") // mark
}
];

point.Model is the item of the Values collection, so with your own types it gives access to all their
properties. In the next case it is a City:
public ISeries[] Series { get; set; } = [
new LineSeries<City>
{
Values = [new() { Population = 4 }, new() { Population = 2 }],
Mapping = (city, index) => new(index, city.Population),
YToolTipLabelFormatter = point => point.Model!.Population.ToString("N2") // mark
}
];
// ...
public class City
{
public double Population { get; set; }
}
XToolTipLabelFormatter adds a header. point.Index is the position of the point in the Values collection:
new LineSeries<double>
{
Values = [2, 1, 3, 5, 3, 4, 6],
Fill = null,
GeometrySize = 20,
XToolTipLabelFormatter = point => $"X = {point.Index}", // mark
YToolTipLabelFormatter = point => point.Model.ToString("C2")
};

Pie series have no X and Y, they use ToolTipLabelFormatter for the value and show no header.
Stacked values
The points of the series that stack (stacked area, stacked step area, stacked column, stacked row and pie series)
have a StackedValue property with the Start, End and Total of the stack, and the Share of the point in that
total, from 0 to 1. See the
stacked series article.
public ISeries[] Series { get; set; } = [
new StackedColumnSeries<double>
{
Values = [2, 1, 3, 5, 3, 4, 6],
YToolTipLabelFormatter =
point => $"{point.Model} / {point.StackedValue!.Total} ({point.StackedValue.Share:P2})"
},
new StackedColumnSeries<int>
{
Values = [4, 2, 5, 2, 4, 5, 3],
YToolTipLabelFormatter =
point => $"{point.Model} / {point.StackedValue!.Total} ({point.StackedValue.Share:P2})"
}
];

Tooltip style
TooltipTextPaint, TooltipTextSize and TooltipBackgroundPaint style the default tooltip. When they are not
set, the default theme draws the text at size 16, dark gray on a light gray background with a shadow (light gray
on a dark gray background in the dark theme).
<CartesianChart
Series="series"
TooltipPosition="LiveChartsCore.Measure.TooltipPosition.Left"
TooltipBackgroundPaint="@tooltipBackgroundPaint"
TooltipTextPaint="@tooltipTextPaint"
TooltipTextSize="16">
</CartesianChart>
@code {
private SolidColorPaint tooltipBackgroundPaint = new(new SKColor(72, 0, 50));
private SolidColorPaint tooltipTextPaint = new(new SKColor(242, 244, 255)) { SKTypeface = SKTypeface.FromFamilyName("Courier New") };
// ...
}

A text wider than 170 pixels wraps to the next line; the limit is MaxTooltipsAndLegendsLabelsWidth in
LiveCharts.DefaultSettings, and legends use it too.
Custom tooltips
Set the Tooltip property of the chart to replace the default tooltip. The easiest way to build your own is to
inherit from SKDefaultTooltip: Initialize() sets the background, the wedge (the triangle that points to the
hovered point) and the animations, and GetLayout() returns the content, built with the LiveCharts layouts
(StackLayout, LabelGeometry and the miniature of each series). Show() and Hide() can be overridden too. In this
sample, each data point has an SVG path, and CustomTooltip draws that path next to the value.

@page "/General/TemplatedTooltips"
@using LiveChartsCore.Drawing
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore;
@using LiveChartsCore.SkiaSharpView;
@using ViewModelsSamples.General.TemplatedTooltips
<CartesianChart
Series="@series"
Tooltip="@CustomTooltip">
</CartesianChart>
@code {
// for simplicity we configure the mapping here
static View()
{
LiveCharts.Configure(config =>
config.HasMap<GeometryPoint>((dataPoint, index) => new(index, dataPoint.Value)));
}
private GeometryPoint[] values = new GeometryPoint[]
{
new GeometryPoint { Value = 4, Geometry = SVGPoints.Star },
new GeometryPoint { Value = 2, Geometry = SVGPoints.Square },
new GeometryPoint { Value = 6, Geometry = SVGPoints.Circle },
new GeometryPoint { Value = 3, Geometry = SVGPoints.Cross },
new GeometryPoint { Value = 5, Geometry = SVGPoints.Diamond }
};
private ISeries[] series;
public CustomTooltip CustomTooltip { get; set; } = new();
protected override void OnInitialized()
{
series = new ISeries[]
{
new ColumnSeries<GeometryPoint> { Values = values }
};
}
}
using System;
using System.Collections.Generic;
using LiveChartsCore;
using LiveChartsCore.Drawing;
using LiveChartsCore.Drawing.Layouts;
using LiveChartsCore.Kernel;
using LiveChartsCore.SkiaSharpView.Drawing;
using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
using LiveChartsCore.SkiaSharpView.Drawing.Layouts;
using LiveChartsCore.SkiaSharpView.Painting;
using LiveChartsCore.SkiaSharpView.SKCharts;
using SkiaSharp;
namespace ViewModelsSamples.General.TemplatedTooltips;
public class CustomTooltip : SKDefaultTooltip
{
// the Initialize method is used to set up the tooltip animations, colors, etc.
protected override void Initialize(Chart chart)
{
var theme = chart.GetTheme();
// the Wedge property, defines the size of the triangle that points to the target point.
Wedge = 5;
Geometry.Fill = theme.TooltipBackgroundPaint;
Geometry.Stroke = new SolidColorPaint(new SKColor(180, 180, 180, 100), 3);
Geometry.Wedge = Wedge;
Geometry.WedgeThickness = 2;
this.Animate(
new Animation(
EasingFunctions.BounceOut,
TimeSpan.FromMilliseconds(500)));
}
// the GetLayout method is used to define the content of the tooltip,
// it is called every time the tooltip changes.
protected override Layout<SkiaSharpDrawingContext> GetLayout(IEnumerable<ChartPoint> foundPoints, Chart chart)
{
var theme = chart.GetTheme();
var layout = new StackLayout
{
Padding = new(10),
Orientation = ContainerOrientation.Vertical,
HorizontalAlignment = Align.Middle,
VerticalAlignment = Align.Middle
};
var i = 0;
foreach (var point in foundPoints)
{
i++;
var series = point.Context.Series;
var geometryPoint = (GeometryPoint)point.Context.DataSource!;
var miniature =
(IDrawnElement<SkiaSharpDrawingContext>)series.GetMiniatureGeometry(point);
var label = new LabelGeometry
{
Text = point.Coordinate.PrimaryValue.ToString("C2"),
Paint = theme.TooltipTextPaint,
TextSize = 15,
Padding = new Padding(8, 0),
VerticalAlign = Align.Start,
HorizontalAlign = Align.Start
};
var customContent = new VariableSVGPathGeometry
{
Fill = theme.TooltipTextPaint,
Width = 30,
Height = 30,
SVGPath = geometryPoint.Geometry
};
var sp = new StackLayout
{
Orientation = ContainerOrientation.Horizontal,
Padding = new Padding(0, 4),
VerticalAlignment = Align.Middle,
HorizontalAlignment = Align.Middle,
Children =
{
miniature,
label,
customContent
}
};
layout.Children.Add(sp);
}
return layout;
}
public override void Show(IEnumerable<ChartPoint> foundPoints, Chart chart)
{
base.Show(foundPoints, chart);
// write code here to add custom behavior when the tooltip is shown.
}
public override void Hide(Chart chart)
{
base.Hide(chart);
// write code here to add custom behavior when the tooltip is hidden.
}
}
Tooltip from scratch
A tooltip can be any class that implements IChartTooltip: the chart calls Show() with the points to show, and
Hide() to close it. Use the
SKDefaultTooltip source code
as a guide, it is the tooltip the library uses by default.
A tooltip drawn with the LiveCharts API can only draw inside the bounds of the chart control, which can cut it in
small charts (#912). You can also build the tooltip with
your UI framework instead, #1558 shows a WPF control
that implements IChartTooltip.
Crosshairs
Crosshairs are set on each axis. CrosshairPaint draws a line that follows the pointer while it is over the plot
area: a vertical line for an X axis, a horizontal one for a Y axis. An axis with no CrosshairPaint draws no
crosshair. The line is removed when the tooltip closes.
CrosshairLabelsPaintdraws a label on the axis with the value under the pointer, formatted with theLabelsorLabelerof the axis and at the axisTextSize.CrosshairLabelsBackgroundis the background color of that label, andCrosshairPaddingits padding; when the padding is not set, the axisPaddingis used.CrosshairSnapEnabledmoves the line to the point closest to the pointer, among the visible series that use that axis, and the label shows the value of that point. It isfalseby default.
In this sample both axes draw a crosshair, and only the Y crosshair snaps to the points:

@page "/Axes/Crosshairs"
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore;
@using LiveChartsCore.SkiaSharpView;
@using LiveChartsCore.Measure;
@using LiveChartsCore.SkiaSharpView.Painting;
@using SkiaSharp;
<CartesianChart
Series="@series"
XAxes="@xAxes"
YAxes="@yAxes">
</CartesianChart>
@code {
private static double[] values = new double[] { 200, 558, 458, 249, 457, 339, 587 };
private static Func<double, string> labelFormatter = value => value.ToString("N2");
private ISeries[] series = new ISeries[]
{
new LineSeries<double> { Values = values }
};
private Axis xAxis;
private Axis yAxis;
private Axis[] xAxes;
private Axis[] yAxes;
// for simplicity we use the page constructor
public View()
{
var crosshairColor = new SKColor(0xFF, 0x8C, 0x00); // #FF8C00
var crosshairLabelsColor = new SKColor(0x8B, 0x00, 0x00); // #8B0000
var crosshairBackground = new LiveChartsCore.Drawing.LvcColor(0xFF, 0x8C, 0x00);
xAxis = new Axis
{
Labeler = labelFormatter,
CrosshairPaint = new SolidColorPaint(crosshairColor),
CrosshairLabelsPaint = new SolidColorPaint(crosshairLabelsColor),
CrosshairLabelsBackground = crosshairBackground
};
yAxis = new Axis
{
Labeler = labelFormatter,
CrosshairPaint = new SolidColorPaint(crosshairColor),
CrosshairLabelsPaint = new SolidColorPaint(crosshairLabelsColor),
CrosshairLabelsBackground = crosshairBackground,
CrosshairSnapEnabled = true
};
xAxes = new[] { xAxis };
yAxes = new[] { yAxis };
}
}
When axes are shared between charts with SharedAxes.Set(), the crosshair moves in all of them, see the
shared axes.